package com.jams.goodox.activity.serve.meet;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.jams.goodox.BaseActivity;
import com.jams.goodox.R;
import com.jams.goodox.adapter.CustomFragmentPagerAdapter;
import com.jams.goodox.utils.StyleUtil;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;

/**
 * 场地预定历史记录
 * Created by jams_zhen on 2017/5/10.
 */

public class MeetHistoryActivity extends BaseActivity{
    @Bind(R.id.tabLayout)
    TabLayout tabLayout;
    @Bind(R.id.viewPager)
    ViewPager viewPager;

    private List<Fragment> fragmentList;

    private MeetHistoryFragment meetHistoryFragment1;
    private MeetHistoryFragment meetHistoryFragment2;


    @Override
    protected int getLayoutId() {
        return R.layout.activity_meet_history;
    }

    @Override
    protected void init() {
        StyleUtil.titleBackKey(this,"预订记录");

        meetHistoryFragment1=MeetHistoryFragment.getInstance(true);
        meetHistoryFragment2=MeetHistoryFragment.getInstance(false);

        fragmentList = new ArrayList<>();
        List<String> tabsTitle = new ArrayList<>();
        fragmentList.add(meetHistoryFragment1);
        tabsTitle.add("可使用");
        fragmentList.add(meetHistoryFragment2);
        tabsTitle.add("已结束");

        viewPager.setAdapter(new CustomFragmentPagerAdapter(getSupportFragmentManager(), tabsTitle, fragmentList));

        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setTabMode(TabLayout.MODE_FIXED);
        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    }
}
